using System;
using System.Data;
using System.Collections.Generic;
using Soccer.Core;
using Soccer.Utility;

namespace Soccer.Business
{
    [TableAttribute("Rounds")]
	[Serializable]
    public class Round : DBO<Round>
    {
		#region Fields
		
		private int? _IdRound;
		private int? _IdSeason;
		private string _RoundName;
		private DateTime? _StartDate;
		private DateTime? _EndDate;
		
		#endregion
		
		#region Constructors
		/// <summary>
		/// Default constructor
		/// </summary>
		public Round()
		{
			
		}
		
		/// <summary>
		/// Constructor with IdRound 
		/// </summary>
		/// <param name="IdRound">The IdRound</param>
		public Round(int? IdRound )
		{
			this.IdRound = IdRound;
		}
		
		/// <summary>
		/// Constructor with all parameters
		/// </summary>
		/// <param name="IdRound">Sets int? value for IdRound</param>
		/// <param name="IdSeason">Sets int? value for IdSeason</param>
		/// <param name="RoundName">Sets string value for RoundName</param>
		/// <param name="StartDate">Sets DateTime? value for StartDate</param>
		/// <param name="EndDate">Sets DateTime? value for EndDate</param>
		public Round(int? idRound, int? idSeason, string roundName, DateTime? startDate, DateTime? endDate)
		{
			this.IdRound = idRound;
			this.IdSeason = idSeason;
			this.RoundName = roundName;
			this.StartDate = startDate;
			this.EndDate = endDate;
		}
		
		#endregion
		
		#region Properties
		
		/// <summary>
		/// Gets or sets int? value for IdRound
		/// </summary>
		[ColumnAttribute("IdRound", SqlDbType.Int , 4 , true, true, false)]
		public int? IdRound
		{
			set
			{
				this._IdRound = value;
			}
			get
			{
				return this._IdRound;
			}
		}
		
		/// <summary>
		/// Gets or sets int? value for IdSeason
		/// </summary>
		[ColumnAttribute("IdSeason", SqlDbType.Int , 4 , false, false, true)]
		public int? IdSeason
		{
			set
			{
				this._IdSeason = value;
			}
			get
			{
				return this._IdSeason;
			}
		}
		
		/// <summary>
		/// Gets or sets string value for RoundName
		/// </summary>
		[ColumnAttribute("RoundName", SqlDbType.NVarChar , 100 , false, false, true)]
		public string RoundName
		{
			set
			{
				this._RoundName = value;
			}
			get
			{
				return this._RoundName;
			}
		}
		
		/// <summary>
		/// Gets or sets DateTime? value for StartDate
		/// </summary>
		[ColumnAttribute("StartDate", SqlDbType.DateTime , 8 , false, false, true)]
		public DateTime? StartDate
		{
			set
			{
				this._StartDate = value;
			}
			get
			{
				return this._StartDate;
			}
		}
		
		/// <summary>
		/// Gets or sets DateTime? value for EndDate
		/// </summary>
		[ColumnAttribute("EndDate", SqlDbType.DateTime , 8 , false, false, true)]
		public DateTime? EndDate
		{
			set
			{
				this._EndDate = value;
			}
			get
			{
				return this._EndDate;
			}
		}
		
		
		/// <summary>
		/// Get a list Match of current Round object base on IdRound
		/// </summary>
		public List<Match> MatchListForIdRound
		{
			get
			{
				if (this.IdRound == null)
					return null;
				Match condition = new Match();
				condition.IdRound = this.IdRound;
				return MatchController.FindItems(condition);
			}
		}
		
		/// <summary>
		/// Get a Season of current Round object base on IdSeason
		/// </summary>
		public Season Season
		{
			get
			{
				if (this.IdSeason == null)
					return null;
	
				Season condition = new Season(this.IdSeason);
				return SeasonController.FindItem(condition);
			}
		}
		
		#endregion
        
        #region Other Properties
        private static ColumnNameStruct? _ColumnName;
        public static ColumnNameStruct ColumnName
        {
            get
            {
                if (!_ColumnName.HasValue)
                    _ColumnName = new ColumnNameStruct();
                return _ColumnName.Value;
            }
        }
        #endregion

        #region NestedType
        public  struct ColumnNameStruct
        {
            /// <summary>
            /// Get the name of column [IdRound]
            /// </summary>
            public string IdRound
            {
                get
                {
                    return "IdRound";
                }
            }
            /// <summary>
            /// Get the name of column [IdSeason]
            /// </summary>
            public string IdSeason
            {
                get
                {
                    return "IdSeason";
                }
            }
            /// <summary>
            /// Get the name of column [RoundName]
            /// </summary>
            public string RoundName
            {
                get
                {
                    return "RoundName";
                }
            }
            /// <summary>
            /// Get the name of column [StartDate]
            /// </summary>
            public string StartDate
            {
                get
                {
                    return "StartDate";
                }
            }
            /// <summary>
            /// Get the name of column [EndDate]
            /// </summary>
            public string EndDate
            {
                get
                {
                    return "EndDate";
                }
            }
        }
        #endregion
    }
}
